package com.situ.pattern.factory;

public class CalFactory {

    public static AbstractCal createCal(int calType) {
        AbstractCal cal = null;
        switch (calType) {
            case 1:
                cal = new Add();
                break;
            case 2:
                cal = new Sub();
                break;
            case 3:
                cal = new Mul();
                break;
        }
        return cal;
    }

    public static AbstractCal createCal2(String calType) {
        AbstractCal cal = null;
        switch (calType) {
            case "add":
                cal = new Add();
                break;
            case "sub":
                cal = new Sub();
                break;
            case "mul":
                cal = new Mul();
                break;
        }
        return cal;
    }
}
